<template>
  <div class="container">
    <div class="header">实验室管理模块 >> 实验室信息管理</div>
    <div class="list-container">
      <div>
        <el-table
          :data="laboratoryList"
          style="width: 100%"
          v-loading="loading"
        >
          <el-table-column
            prop="name"
            label="实验室号"
            width="180"
          ></el-table-column>
          <el-table-column
            prop="description"
            label="实验室描述"
            width="180"
          ></el-table-column>
          <el-table-column
            prop="number"
            label="容纳人数"
            width="200"
          ></el-table-column>
          <el-table-column
            prop="createTime"
            label="创建日期"
            width="200"
          ></el-table-column>
          <el-table-column
            prop="updateTime"
            label="修改日期"
            width="200"
          ></el-table-column>
          <el-table-column label="操作" width="180">
            <template #default="scope">
              <router-link
                class="operation"
                :to="{ path: '/admin/laboratories/' + scope.row.id }"
              >
                <i class="el-icon-edit-outline"></i>
                更多操作
              </router-link>
            </template>
            <!-- <template>
              <router-link
                :to="{ path: '/admin/teachers/' + id }"
              ></router-link>
            </template> -->
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
import { State } from "@/store";
import { useStore } from "vuex";
import { computed, defineComponent } from "vue";
import { LIST_LABORATORY } from "@/store/VuexTypes";

export default defineComponent({
  setup() {
    const store = useStore<State>();
    const loading = computed(() => store.state.loading);
    const laboratoryList = computed(() => store.state.laboratoryList);
    store.dispatch(LIST_LABORATORY);
    return {
      loading,
      laboratoryList,
    };
  },
});
</script>

<style scoped>
.container {
  height: 100%;
  width: 100%;
}
.header {
  width: 90%;
  padding: 5px 5px 10px;
  border-bottom: 1px solid #ccc;
  font-size: 12px;
  color: grey;
  margin-bottom: 20px;
}
.list-container {
  height: 92%;
  width: 100%;
}
.list-search {
  border: 1px solid #ccc;
  width: 90%;

  margin: 10px auto;
  border-radius: 5px;
  padding: 15px 0 15px 30px;
  box-shadow: 5px 5px 5px #ccc;
}
.input {
  width: 150px;
}
.search-btn {
  margin-left: 50px;
}
.operation {
  text-decoration: none;
  display: block;
  width: 100px;

  border-radius: 5px;

  color: white;
  background-color: violet;
  text-align: center;
  padding: 5px;
}
</style>
